import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AnglingVO, AnglingQuery  } from '@/api/front/angling/types';
import { RouteParamValue } from "vue-router";

/**
 * @description 搜索下拉框
 * @param type
 * @returns
 */
export const searchOptions = (type: String): AxiosPromise<any> => {
  return request({
    url: '/api/fishSite/search/options',
    method: 'get',
    params: {type}
  });
};

/**
 * @description 获取详情
 * @returns
 */
export const getPublicDetail = (fishSiteId: number): AxiosPromise<AnglingVO> => {
  return request({
    url: '/api/fishSite/get/public/' + fishSiteId,
    method: 'get',
  });
};


/**
 * @description 钓场分页列表
 * @param query
 * @param formData
 * @returns
 */
export const anglingList = (query?: any, formData?: AnglingQuery): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/list',
      method: 'post',
      params: query,
      data: formData
    });
};

/**
 * @description 显示用户自己的列表
 * @param query 
 * @returns 
 */
export const anglingUserList = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/user/list',
      method: 'get',
      params: query
    });
};

/**
 * @description 返回用户收藏的钓点
 * @param query 
 * @returns 
 */
export const anglingUserCollectList = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/user/collect/list',
      method: 'get',
      params: query
    });
};

/**
 * @description 删除钓点数据
 * @param query 
 * @returns 
 */
export const anglingDelete = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/delete',
      method: 'post',
      data: query
    });
};

/**
 * @description 存储钓场数据
 * @param query 
 * @returns 
 */
export const anglingSave = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/save',
      method: 'post',
      data: query
    });
};

/**
 * @description 设置自己的钓场的公开or隐私
 * @param query 
 * @returns 
 */
export const anglingSetPublic = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/public',
      method: 'post',
      data: query
    });
};

/**
 * @description 钓场推荐
 * @param query 
 * @returns 
 */
export const anglingHot = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/hot',
      method: 'get',
      params: query
    });
};

/**
 * @description 添加评论
 * @param formData
 * @returns 
 */
export const anglingCommentPush = (formData?: any): AxiosPromise<any> => {
    return request({
      url: '/api/comment/fishSite',
      method: 'post',
      data: formData
    });
};

/**
 * @description 获取钓点评论
 * @param query 
 * @returns 
 */
export const anglingCommentGet = (query?: any): AxiosPromise<any> => {
    return request({
      url: '/api/comment/fishSite/page/list',
      method: 'get',
      params: query
    });
};

/**
 * @description 编辑钓场
 * @param formData 
 * @returns 
 */
export const anglingUpdate = (formData?: any): AxiosPromise<any> => {
    return request({
      url: '/api/fishSite/update',
      method: 'post',
      data: formData
    });
};